package com.powernode.controller;

import com.github.pagehelper.PageInfo;
import com.powernode.model.R;
import com.powernode.service.CustomerService;
import com.powernode.vo.CustomerVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/customer")
public class CustomerController {
    @Autowired
    private CustomerService customerService;

    /**
     * 分页查询客户信息列表
     * @param current
     * @param size
     * @return
     */
    @GetMapping("/page")
    public R<PageInfo<CustomerVo>> loadCustomerPage(@RequestParam Integer current,
                                                    @RequestParam(required = false, defaultValue = "10") Integer size) {
        PageInfo<CustomerVo> pageInfo = customerService.queryCustomerListPage(current,size);
        return R.OK(pageInfo);
    }
}
